Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

301
Vistas
Getting "Cannot get/" when using a node image with docker and express

After a lot of tries I finally managed to get docker on my computer. So I have an app1 directory with the following files:

Dockerfile:

FROM node:latest
EXPOSE 8080

WORKDIR /app

COPY package-lock.json  .
COPY package.json .

RUN npm install

CMD ["npm", "start"]

package.json:

{
  "name": "app1",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "start": "node src/server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

Then a src directory with server.js:

'use strict';


// load package
const express = require('express');


const PORT = 8080;
const HOST = '0.0.0.0';
const app = express();
 
 
app.get('/greeting', (req,res) => {
        
         res.send('hello ');
   });

 app.use('/', express.static('pages'));

   
app.listen(PORT, HOST);

console.log('up and running');

From the app1 directory I run: docker build -t raff/node . The image gets built with no issues. So I try to run docker with sudo docker run --rm -p 3000:8080 -v /Users/me/Desktop/app1/src:/app/src -it raff/node

So I get message that node is up and running and as soon as I open localhost:3000 I get the error message.

Could someone point it out what's wrong?

Edit: Included the absolute path that was omitted before.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda